export interface jwtPayload {
  username: string;
  nickname: string;
  role: number;
  userID: number;
  iss: number;
  exp: number;
}

export const parseToken = (token: string) => {
  const payLoadString = token
    .split(".")[1]
    .replace(/-/g, "+")
    .replace(/_/g, "/");
  return JSON.parse(
    decodeURIComponent(escape(atob(payLoadString)))
  ) as jwtPayload;
};
